/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package us.icitap.cm.business.entities.regmin;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import us.icitap.cm.business.entities.BaseEntity;


/**
 *
 * @author klau
 */
@Entity
@Table(name = "DISTRICT", schema="REGMIN")
public class District  implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "CODE_DISTRICT", nullable = false)
    private String codeDistrict;
    @Column(name = "TAG")
    private String tag;
   
    @JoinColumn(name = "CODE_REGION", referencedColumnName = "CODE_REGION")
    @ManyToOne
    private Region region;

    public District() {
    }

    public District(String codeDistrict) {
        this.codeDistrict = codeDistrict;
    }

    public String getCodeDistrict() {
        return codeDistrict;
    }

    public void setCodeDistrict(String codeDistrict) {
        this.codeDistrict = codeDistrict;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

 
    public Region getRegion() {
        return region;
    }

    public void setRegion(Region region) {
        this.region = region;
    }



    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codeDistrict != null ? codeDistrict.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof District)) {
            return false;
        }
        District other = (District) object;
        if ((this.codeDistrict == null && other.codeDistrict != null) || (this.codeDistrict != null && !this.codeDistrict.equals(other.codeDistrict))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.getTag();
    }

}
